<template>
  <div>
    <h3>优惠券列表</h3>
    <table class="table table-bordered">
      <tbody>
        <tr>
          <td>优惠券类型</td>
          <td>优惠券标题</td>
          <td>门店名称</td>
        </tr>
        <tr v-for="item in list">
          <td>
            <span v-if="item.DiscoutType == 1">代金券</span>
            <span v-if="item.DiscoutType == 2">折扣券</span>
            <span v-if="item.DiscoutType == 3">兑换券</span>
          </td>
          <td>{{ item.Title }}</td>
          <td>{{ item.ShopName }}</td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import axios from 'axios';
import moment from 'moment';
import { useRouter, useRoute } from 'vue-router';

const router = useRouter();
const route = useRoute();

let list: any = ref([]);

onMounted(() => {
  getList();
});

const getList = () => {
  axios({
    url: '/api/Discounts/GetDiscountList',
    method: 'get',
  })
    .then((res) => {
      console.log(res);
      list.value = res.data;
    })
    .catch((err) => {
      console.log(err);
    });
};
</script>

<style scoped></style>
